<template>
  <div>
    <!-- 头部 -->
    <div class="header">
      <div class="goto" @click="goto()">
        <img src="../../assets/home_img/left.png" alt="">
      </div>
      <p>选择收货地址</p>
    </div>
    <div style="height: 2.4rem"></div>
    <!-- 内容 -->
    <div class="card" v-for="(item, index) in siteData" :key="index">
      <div class="cardbox">
        <img src="../../assets/site_img/name.png" alt="" class="cardimg">
        <p>{{item.contact}}</p>
      </div>
      <div class="cardbox">
        <img src="../../assets/site_img/phone.png" alt="" class="cardimg">
        <p>{{item.mobile}}</p>
      </div>
      <div class="cardbox">
        <img src="../../assets/site_img/site1.png" alt="" class="cardimg1">
        <div class="sitetext">
          <p>{{item.address}}</p>
        </div>
      </div>
      <div style="height: 0.4rem"></div>
      <div class="cardfooter">
        <p @click="okDefault(index)">选择该地址</p>
      </div>
    </div>
    <div style="height: 6rem"></div>

    <!-- 编辑 -->
    <div class="winshow" v-if="winshow1">
      <div class="an"></div>
      <div class="ming">
        <div class="imgmingtext">
          <p>{{msgtext}}</p>
        </div>
        <div class="snmingbtnbox">
          <div class="imgmingbtn" @click="nonewin()">
            <p>取消</p>
          </div>
          <div class="imgmingbtn" style="width: 2.5rem; border: none"></div>
          <div class="imgmingbtn" @click="compileSite()">
            <p>确定</p>
          </div>
        </div>
      </div>
    </div>

  </div>
</template>

<script>
  export default {
    data(){
      return{
        //  地址信息、
        siteData:'',


        //  弹框
        winshow: false,
        winshow1: false,
        msgtext:'',
        showText: false,
      }
    },
    components:{

    },
    created(){
      this.siteList();
    },
    methods:{
      goto(){
        this.$router.go(-1)
      },
      //  请求地址接口
      siteList(){
        let postData = this.$qs.stringify({
          offset:'',
          limit:'',
          storeId: 1,
        });
        this.$axios({
          method:'POST',
          url:'api/address/addressList',
          data:postData
        }).then((res)=>{
          console.log(res.data.msg);
          this.siteData = res.data.data;
        }).catch((err)=>{
          console.log(err);
        })
      },





    },

  }

</script>

<style scoped>
  *{
    margin: 0;
    padding: 0;
  }
  .header {
    width: 100%;
    height: 2.4rem;
    text-align: center;
    background: #609FE0;
    z-index: 999;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
  }
  .header p {
    line-height: 2.4rem;
    font-size: 1.05rem;
    color: white;
    font-weight: bolder;
  }
  .goto {
    position: relative;
  }
  .goto img {
    width: 1.8rem;
    height: 1.8rem;
    position: absolute;
    top: 0.3rem;
    left: 0.15rem;
  }

  /* 内容 */
  .card {
    width: 94%;
    /*height: 10rem;*/
    margin-left: 3%;
    background: white;
    border: 1px solid gainsboro;
    border-radius: 0.25rem;
    margin-top: 1rem;
    position: relative;
  }
  .cardbox {
    margin-left: 0.6rem;
    padding-top: 0.3rem;
    position: relative;
  }
  .cardimg {
    width: 1.5rem;
    height: 1.5rem;
    vertical-align: bottom;
  }
  .cardbox p {
    display: inline;
    line-height: 1.6rem;
    font-size: 0.9rem;
    color: #666666;
    margin-left: 0.4rem;
  }
  .cardimg1 {
    width: 1.5rem;
    height: 1.5rem;
    position: absolute;
  }
  .sitetext {
    width: 80%;
    margin-left: 10%;
    background: #f2f2f2;
    padding: 0.1rem 0.7rem;
    border-radius: 0.25rem;
  }
  .cardfooter {
    width: 100%;
    height: 2.4rem;
    border-top: 1px solid gainsboro;
    text-align: center;
  }
  .cardfooter p {
    font-size: 0.88rem;
    line-height: 2.4rem;
    color: #609FE0;
  }

  /* 弹框 */
  .winshow {
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
  }
  .an {
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    background: black;
    opacity: 0.4;
  }
  .ming {
    width: 80%;
    height: 10rem;
    background: white;
    position: fixed;
    top: 30%;
    left: 10%;
    border-radius: 0.25rem;
  }
  .snmingbtnbox {
    text-align: center;
    border-top: 1px solid gainsboro;
  }
  /*  上传图片弹出框提示  */
  .imgmingtext {
    text-align: center;
    height: 6.8rem;
  }
  .imgmingtext p {
    line-height: 6.8rem;
    font-size: 0.98rem;
    color: #666666;
  }
  /*图片按钮*/
  .imgmingbtn {
    display: inline-block;
    width: 5rem;
    border: 1px solid gainsboro;
    border-radius: 0.25rem;
    margin-top: 0.6rem;
    /*margin-left: 35%;*/
  }
  .imgmingbtn p {
    line-height: 1.9rem;
    color: #666666;
    font-size: 0.88rem;
  }
</style>